package util

func SplitArray(arr *[]int, num int64) [][]int {
	max := int64(len(*arr))
	if max < num {
		return nil
	}
	var segmens = make([][]int, 0)
	quantiry := max / num
	end := int64(0)
	for i := int64(1); i <= num; i++ {
		qu := i * quantiry
		if i != num {
			segmens = append(segmens, (*arr)[i-1+end:qu])
		} else {
			segmens = append(segmens, (*arr)[i-1+end:])
		}
		end = qu - i
	}
	return segmens
}
